package org.example.client;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import org.example.protocol.RacingCarDecoder;
import org.example.protocol.RacingCarEncoder;

class MyChannelHandler extends ChannelInitializer<SocketChannel> {
        @Override
        protected void initChannel(SocketChannel ch) throws Exception {
            // 添加自定义协议的编解码工具
            ch.pipeline().addLast(new RacingCarEncoder());
            ch.pipeline().addLast(new RacingCarDecoder());
            // 处理网络IO
            ch.pipeline().addLast(new ClientHandler());
        }

    }